package com.yang.thread.priority;

/**
 * @author yds
 * @program thread-study
 * @description 测试线程优先级是否绝对左右线程执行顺序
 * @create 2020-10-28 14:12
 **/
public class ThreadPriority {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (true) {
                System.out.println("t1 优先级为3");
            }
        });
        Thread.sleep(1000);
        thread.setPriority(3);
        Thread thread2 = new Thread(() -> {
            while (true) {
                System.out.println("t2 优先级为10");
            }
        });
        thread2.setPriority(10);
        thread.start();
        thread2.start();
    }
}